Skip to content

test: add WebSocket terminal I/O route tests#43

Merged
Ark0N merged 1 commit intofeat/ws-terminal-io-upstreamfrom
feat/ws-tests
Mar 14, 2026
Merged

test: add WebSocket terminal I/O route tests#43
Ark0N merged 1 commit intofeat/ws-terminal-io-upstreamfrom
feat/ws-tests

Conversation

@Ark0N
Copy link
Copy Markdown
Owner

@Ark0N Ark0N commented Mar 14, 2026

Summary

  • Adds 16 automated tests for the WebSocket route in src/web/routes/ws-routes.ts
  • Covers the full protocol: session lookup (4004 close code), terminal output with DEC 2026 sync markers, clearTerminal/needsRefresh events, client input forwarding via session.write(), MAX_INPUT_LENGTH enforcement, malformed JSON resilience, resize bounds validation (min/max/non-integer/negative), and connection cleanup of session event listeners
  • Uses a real Fastify server on port 3170 with @fastify/websocket and ws client since app.inject() doesn't support WebSocket upgrades

Test plan

  • All 16 tests pass: npx vitest run test/routes/ws-routes.test.ts
  • TypeScript type check passes: npx tsc --noEmit
  • Lint passes: npm run lint
  • Format check passes: npm run format:check

🤖 Generated with Claude Code

16 tests covering session-not-found close code, terminal output with
DEC 2026 sync markers, client input forwarding, resize bounds
validation, malformed message handling, and connection cleanup of
session event listeners.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Ark0N Ark0N merged commit abbbf9e into feat/ws-terminal-io-upstream Mar 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant